class ApplicationAccountSettingsController < ApplicationController
  # GET /application_account_settings
  # GET /application_account_settings.xml
  def index
    @application_account_settings = ApplicationAccountSetting.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @application_account_settings }
    end
  end

  # GET /application_account_settings/1
  # GET /application_account_settings/1.xml
  def show
    @application_account_settings = ApplicationAccountSetting.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @application_account_settings }
    end
  end

  # GET /application_account_settings/new
  # GET /application_account_settings/new.xml
  def new
    basic_data
    
    @application_account_settings = ApplicationAccountSetting.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @application_account_settings }
    end
  end

  # GET /application_account_settings/1/edit
  def edit
    basic_data
    
    @application_account_settings = ApplicationAccountSetting.find(params[:id])
    @statuses = ApplicationAccountSetting.statuses
  end

  # POST /application_account_settings
  # POST /application_account_settings.xml
  def create
    basic_data
    
    @application_account_settings = ApplicationAccountSetting.new(params[:application_account_setting])

    respond_to do |format|
      if @application_account_settings.save
        flash[:notice] = 'ApplicationAccountSetting was successfully created.'
        format.html { redirect_to(@application_account_settings) }
        format.xml  { render :xml => @application_account_settings, :status => :created, :location => @application_account_settings }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @application_account_settings.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /application_account_settings/1
  # PUT /application_account_settings/1.xml
  def update
    basic_data
    
    @application_account_settings = ApplicationAccountSetting.find(params[:id])
    @statuses = ApplicationAccountSetting.statuses

    respond_to do |format|
      if @application_account_settings.update_attributes(params[:application_account_setting])
        flash[:notice] = 'ApplicationAccountSetting was successfully updated.'
        format.html { redirect_to(@application_account_settings) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @application_account_settings.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /application_account_settings/1
  # DELETE /application_account_settings/1.xml
  def destroy
    @application_account_settings = ApplicationAccountSetting.find(params[:id])
    @application_account_settings.destroy

    respond_to do |format|
      format.html { redirect_to(application_account_settings_url) }
      format.xml  { head :ok }
    end
  end
  
  private
  def basic_data
    @application_accounts = ApplicationAccount.find.all
    @presettings = ApplicationAccountSetting.presettings
  end
end
